package org.jeecg.common.util.tencent.response;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

/**
 * @author guoyh
 * @ClassName IMResult
 * @Description @JsonProperty解决首字母大写问题
 * @since 2020/8/22 21:41
 **/
@Data
public class IMBaseResponse {

    @JsonProperty(value = "ActionStatus")
    private String actionStatus;

    @JsonProperty(value = "ErrorInfo")
    private String errorInfo = "";

    @JsonProperty(value = "ErrorCode")
    private Integer errorCode;

    public static IMBaseResponse buildSuccess(){
        IMBaseResponse response = new IMBaseResponse();
        response.setErrorInfo("");
        response.setErrorCode(0);
        response.setActionStatus("OK");
        return response;
    }

    public static IMBaseResponse buildFail(String reason){
        IMBaseResponse response = new IMBaseResponse();
        response.setErrorInfo(reason);
        response.setErrorCode(1);
        response.setActionStatus("OK");
        return response;
    }
}
